package com.wholesale.beans;

import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class GoodsDetail {

	private int brandId;
	private int catId;
	private int clickCount;
	private String goodsBrief;
	private GoodsDescribe goodsDesc;
	private int goodsId;
	private String goodsImg;
	private String goodsName;
	private String goodsNameStyle;
	private int goodsNumber;
	private String goodsSn;
	private int goodsType;
	private double goodsWeight;
	private boolean isReal;
	private boolean isBest;
	private boolean isNew;
	private boolean isHot;
	private boolean isPromote;
	private boolean isFreeshipping;
	private double marketPrice;
	private double shopPrice;
	private double promotePrice;
	private String promoteStartDate;
	private String promoteEndDate;
	private JSONObject jsonObject;

	// add by dave
	private double discountPrice;// 打折价格
	private String discountName; // 打折名称

	public double getDiscountPrice() {
		return discountPrice;
	}

	public void setDiscountPrice(double discountPrice) {
		this.discountPrice = discountPrice;
	}

	public String getDiscountName() {
		return discountName;
	}

	public void setDiscountName(String discountName) {
		this.discountName = discountName;
	}

	public int getBrandId() {

		return brandId;
	}

	public void setBreandId(int brandId) {
		this.brandId = brandId;
	}

	public int getCatId() {

		return catId;
	}

	public void setCatId(int catId) {
		this.catId = catId;
	}

	public int getClickCount() {

		return clickCount;
	}

	public void setClickCount(int clickCount) {
		this.clickCount = clickCount;
	}

	public String getGoodsBrief() {

		return goodsBrief;
	}

	public void setGoodsBrief(String goodsBrief) {
		this.goodsBrief = goodsBrief;
	}

	public GoodsDescribe getGoodsDesc() {

		return goodsDesc;
	}

	public void setGoodsDesc(GoodsDescribe goodsDesc) {
		this.goodsDesc = goodsDesc;
	}

	public int getGoodsId() {

		return goodsId;
	}

	public void setGoodsId(int goodsId) {
		this.goodsId = goodsId;
	}

	public String getGoodsImg() {

		return goodsImg;
	}

	public void setGoodsImg(String goodsImg) {
		this.goodsImg = goodsImg;
	}

	public String getGoodsName() {

		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}

	public String getGoodsNameStyle() {

		return goodsNameStyle;
	}

	public void setGoodsNameStyle(String goodsNameStyle) {
		this.goodsNameStyle = goodsNameStyle;
	}

	public int getGoodsNumber() {

		return goodsNumber;
	}

	public void setGoodsNumber(int goodsNumber) {
		this.goodsNumber = goodsNumber;
	}

	public String getGoodsSn() {

		return goodsSn;
	}

	public void setGoodsSn(String goodsSn) {
		this.goodsSn = goodsSn;
	}

	public int getGoodsType() {

		return goodsType;
	}

	public void setGoodsType(int goodsType) {
		this.goodsType = goodsType;
	}

	public double getGoodsWeight() {

		return goodsWeight;
	}

	public void setGoodsWeight(double goodsWeight) {
		this.goodsWeight = goodsWeight;
	}

	public boolean isReal() {

		return isReal;
	}

	public void setReal(boolean isReal) {
		this.isReal = isReal;
	}

	public boolean isBest() {

		return isBest;
	}

	public void setBest(boolean isBest) {
		this.isBest = isBest;
	}

	public boolean isNew() {

		return isNew;
	}

	public void setNew(boolean isNew) {
		this.isNew = isNew;
	}

	public boolean isHot() {

		return isHot;
	}

	public void setHot(boolean isHot) {
		this.isHot = isHot;
	}

	public boolean isPromote() {

		return isPromote;
	}

	public void setPromote(boolean isPromote) {
		this.isPromote = isPromote;
	}

	public boolean isFreeshipping() {

		return isFreeshipping;
	}

	public void setFreeshipping(boolean isFreeshipping) {
		this.isFreeshipping = isFreeshipping;
	}

	public double getMarketPrice() {

		return marketPrice;
	}

	public void setMarketPrice(double marketPrice) {
		this.marketPrice = marketPrice;
	}

	public double getShopPrice() {

		return shopPrice;
	}

	public void setShopPrice(double shopPrice) {
		this.shopPrice = shopPrice;
	}

	public double getPromotePrice() {

		return promotePrice;
	}

	public void setPromotePrice(double promotePrice) {
		this.promotePrice = promotePrice;
	}

	public String getPromoteStartDate() {

		return promoteStartDate;
	}

	public void setPromoteStartDate(String promoteStartDate) {

		this.promoteStartDate = promoteStartDate;
	}

	public String getPromoteEndDate() {

		return promoteEndDate;
	}

	public void setPromoteEndDate(String promoteEndDate) {
		this.promoteEndDate = promoteEndDate;
	}

	public void jsonAnalytic(String jsonString) {

		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
		}
	}

	public void jsonAnalytic(JSONObject jsonObject) {
		this.jsonObject = jsonObject;

		try {
			goodsId = jsonObject.getInt("goodsId");
		} catch (JSONException e) {

		}
		try {
			catId = jsonObject.getInt("catId");
		} catch (JSONException e) {

		}
		try {
			goodsSn = jsonObject.getString("goodsSn");
		} catch (JSONException e) {

		}
		try {
			goodsName = jsonObject.getString("goodsName");
		} catch (JSONException e) {

		}
		try {
			goodsNameStyle = jsonObject.getString("goodsNameStyle");
		} catch (JSONException e) {

		}
		try {
			clickCount = jsonObject.getInt("clickCount");
		} catch (JSONException e) {

		}
		try {
			brandId = jsonObject.getInt("brandId");
		} catch (JSONException e) {

		}
		try {
			goodsNumber = jsonObject.getInt("goodsNumber");
		} catch (JSONException e) {

		}
		try {
			goodsWeight = jsonObject.getDouble("goodsWeight");
		} catch (JSONException e) {

		}
		try {
			marketPrice = jsonObject.getDouble("marketPrice");
		} catch (JSONException e) {

		}
		try {
			shopPrice = jsonObject.getDouble("shopPrice");
		} catch (JSONException e) {

		}
		try {
			promotePrice = jsonObject.getDouble("promotePrice");
		} catch (JSONException e) {

		}
		try {
			goodsBrief = jsonObject.getString("goodsBrief");
		} catch (JSONException e) {

		}
		goodsDesc = new GoodsDescribe();
		try {
			goodsDesc.jsonAnalytic(jsonObject.getString("goodsDesc"));
		} catch (JSONException e) {

		}
		try {
			goodsImg = jsonObject.getString("goodsImg");
		} catch (JSONException e) {

		}
		try {
			if (!jsonObject.getString("isReal").equals("")
					&& jsonObject.getString("isReal").equals("1")) {
				isReal = true;
			}
		} catch (JSONException e) {
		}
		try {
			if (!jsonObject.getString("isBest").equals("")
					&& jsonObject.getString("isBest").equals("1")) {
				isBest = true;
			}
		} catch (JSONException e) {

		}
		try {
			if (!jsonObject.getString("isNew").equals("")
					&& jsonObject.getString("isNew").equals("1")) {
				isNew = true;
			}
		} catch (JSONException e) {
		}
		try {
			if (!jsonObject.getString("isHot").equals("")
					&& jsonObject.getString("isHot").equals("1")) {
				isHot = true;
			}
		} catch (JSONException e) {
		}
		try {
			if (!jsonObject.getString("isPromote").equals("")
					&& jsonObject.getString("isPromote").equals("1")) {
				isPromote = true;
			}
		} catch (JSONException e) {
		}
		try {
			if (!jsonObject.getString("isFreeshipping").equals("")
					&& jsonObject.getString("isFreeshipping").equals("1")) {
				isFreeshipping = true;
			}
		} catch (JSONException e) {
		}
		try {
			goodsType = jsonObject.getInt("goodsType");
		} catch (JSONException e) {
		}
		try {
			promoteStartDate = jsonObject.getString("promoteStartDate");
		} catch (JSONException e) {
		}
		try {
			promoteEndDate = jsonObject.getString("promoteEndDate");
		} catch (JSONException e) {
		}
		try {
			discountPrice = jsonObject.getDouble("discountPrice");
		} catch (JSONException e) {
		}
		try {
			discountName = jsonObject.getString("discountName");
		} catch (JSONException e) {
		}

	}
}
